import { http } from "@/utils/http";
import { baseUrlApi } from "./utils";
import type { aqiType } from "@/store/types";

export type FeedbackResult = {
  code: number;
  message: string;
  data: {
    aqi: aqiType;
  };
};

export const getAqi = (aqiLevel: number) => {
  return http.request<FeedbackResult>(
    "get",
    baseUrlApi("/result/aqigrade/getAqiGradeByLevel"),
    {
      params: {
        aqiLevel: aqiLevel
      }
    }
  );
};

export const getAqiMap = () => {
  return http.request("post", baseUrlApi("/result/aqigrade/getAqiGrades"));
};

export const listAqiGrades = () => {
  return http.request<FeedbackResult>(
    "post",
    baseUrlApi("/result/aqigrade/getAqiGrades")
  );
};
